#!/bin/zsh
# -----------------------------------------------------------------------------
# Script Name: run-uninstall.sh
# Description: Executes the App-Auto-Patch-via-Dialog.zsh script with the
#              '--uninstall' flag in the current directory.
#
# Usage: Place this script in the same directory as App-Auto-Patch-via-Dialog.zsh,
#        then execute it from Terminal using:
#              ./run-uninstall.sh
#
# Note: Ensure that both this script and App-Auto-Patch-via-Dialog.zsh have
#       executable permissions.
#
# Author: [Your Name]
# Date: 2025-04-08
# -----------------------------------------------------------------------------

# Check if the App-Auto-Patch-via-Dialog.zsh script exists in the current directory.
if [[ ! -f "./App-Auto-Patch-via-Dialog.zsh" ]]; then
    echo "Error: 'App-Auto-Patch-via-Dialog.zsh' not found in the current directory."
    exit 1
fi

# Execute the App-Auto-Patch script with the '--uninstall' flag.
./App-Auto-Patch-via-Dialog.zsh --uninstall

# Store the exit code of the previous command.
exit_status=$?

# Check the exit status to see if the command ran successfully.
if [[ $exit_status -eq 0 ]]; then
    echo "Uninstallation successful."
else
    echo "Uninstallation failed with exit code $exit_status."
fi
